import click
from app.service_quality.script.qos_click import QosClick


@click.group()
def qos_alarm():
    pass


# @qos_alarm.command("qos_host_date_sync_from_prom")
# @click.option('--quality_date', type=str, help="同步主机监控数据的日期")
# def qos_host_date_sync_from_prom(quality_date):
#     """
#     按日期同步主机监控信息
#     python manage.py qos_host_date_sync_from_prom --quality_date 2022-11-01
#     """
#     qos_click = QosClick()
#     qos_click.host_date_sync_from_prom({"quality_date": quality_date})


# @qos_alarm.command("qos_host_date_to_excel")
# @click.option('--quality_date', type=str, help="导出主机监控数据的日期")
# def qos_host_date_to_excel(quality_date):
#     """
#     按日期导出主机监控信息
#     python manage.py qos_host_date_to_excel --quality_date 2022-08-25
#     """
#     qos_click = QosClick()
#     qos_click.host_date_to_excel({"quality_date": quality_date})


@qos_alarm.command("qos_server_info_sync_from_k8s")
def qos_server_info_sync_from_k8s():
    """
    同步容器服务的信息到数据库
    python manage.py qos_server_info_sync_from_k8s
    """
    qos_click = QosClick()
    qos_click.server_info_sync_from_k8s()


# @qos_alarm.command("qos_server_info_sync_from_excel")
# @click.option('--file_path', type=str, help="excel文件路径")
# def qos_server_info_sync_from_excel(file_path):
#     """
#     同步物理服务的信息到数据库
#     python manage.py qos_server_info_sync_from_excel --file_path 物理服务梳理.xlsx
#     """
#     qos_click = QosClick()
#     qos_click.server_info_sync_from_excel(file_path)



@qos_alarm.command("qos_server_date_sync_from_prom")
@click.option('--quality_date', type=str, help="同步应用服务监控数据的日期")
def qos_server_date_sync_from_prom(quality_date):
    """
    同步应用服务监控数据到数据库
    python manage.py qos_server_date_sync_from_prom --quality_date 2022-08-25
    """
    qos_click = QosClick()
    qos_click.server_date_sync_from_prom({"quality_date": quality_date})


@qos_alarm.command("qos_server_date_to_excel")
@click.option('--quality_date', type=str, help="导出应用服务质量数据的日期")
def qos_server_date_to_excel(quality_date):
    """
    导出应用服务质量数据到excel
    python manage.py qos_server_date_to_excel --quality_date 2022-08-25
    """
    qos_click = QosClick()
    qos_click.server_date_to_excel({"quality_date": quality_date})
    
    
@qos_alarm.command("qos_server_tuiguang_to_excel")
@click.option('--quality_date', type=str, help="推广的日期")
def qos_server_tuiguang_to_excel(quality_date):
    """
    导出推广时容器服务的cpu数据到excel
    python manage.py qos_server_tuiguang_to_excel --quality_date 2023-09-22
    """
    qos_click = QosClick()
    qos_click.qos_server_tuiguang_to_excel(quality_date)